package sound;

import com.jme.scene.Controller;

public abstract class SoundContinueController extends Controller {
	
	private static final long serialVersionUID = 1L;
	
	protected String firstFile, secondFile, firstSourceName, secondSourceName;
	
	public SoundContinueController(String firstFile, String secondFile) {
		this.firstFile = firstFile;
		this.secondFile = secondFile;
	}
	
	public void init() {
		firstSourceName = playFirstFile();
	}
	
	@Override
	public void update(float time) {
		if(!AudioManager.get().isPlaying(firstSourceName)) {
			secondSourceName = playSecondFile();
			AudioManager.get().removeController(this);
		}
	}
	
	protected abstract String playFirstFile();
	
	protected abstract String playSecondFile();
	
	public String getFirstSourceName() { return firstSourceName; }
	
	public String getSecondSourceName() { return secondSourceName; }
}